<div class="container">
	<form class="form-horizontal" role="form" method="post" action="#">
	<div class="col-md-offset-1">
		<div class="col-md-11">
			<div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> User Login</b></h4></div>
				<div class="panel-body">
					<div class="col-xs-12 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">NIK</label>
							<div class="col-md-3"><input type="text" value="<?php echo $sesNik;?>" id="pNik" class="select2 form-control input-sm" readonly="true"/></div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Name</label>
							<div class="col-md-7"><input type="text" value="<?php echo $sesName;?>" id="pName" class="select2 form-control input-sm" readonly="true"/></div>
						</div>
					</div>          
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7"><input type="text" value="<?php echo $sesOrg;?>" id="pDept" class="select2 form-control input-sm" readonly="true"/></div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8"><input type="text" value="<?php echo $sesJob;?>" id="pJob" class="select2 form-control input-sm" readonly="true"/></div>
						</div>
					</div>
				</div>
			</div>		
			<div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Request By</b></h4></div>
				<div class="panel-body">
					<div class="col-xs-12 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Name<span style="color:red;">*</span></label>
							<div class="col-md-7"><input type="text" value="" id="r_name" required="required" class="select2 form-control input-sm">
							<input type="hidden" value="" id="r_nama" class="select2 form-control input-sm" readonly="true"/></div>
						</div>					
						<div class="form-group">
							<label class="control-label col-md-4">ID Number</label>
							<div class="col-md-3"><input type="text" value="" id="r_id" class="form-control input-sm" readonly /></div>
						</div>
						<script>
							function cek_other_mgr(){
								if (document.getElementById){ 
									obj = document.getElementById('script2'); 
									if (obj.style.display == "none"){ 
										obj.style.display = ""; 
										obj2 = document.getElementById('script1');
										obj2.style.display = "none"; 
										obj3 = document.getElementById('r_mgrid');
										obj4 = document.getElementById('temp');
										obj3.value = obj4.value;
										obj5 = document.getElementById('tag_flag');
										obj5.value = '0';
									} else {
										obj.style.display = "none"; 
										obj2 = document.getElementById('script1');
										obj2.style.display = ""; 
										obj3 = document.getElementById('r_mgrid');
										obj4 = document.getElementById('temp');
										obj4.value = obj3.value;
									}
								} 
							}
							
							function getMgrid(id,id2){
								if (document.getElementById){ 
									obj = document.getElementById(id);
									obj2 = document.getElementById(id2);
									obj2.value = obj.value;
									obj3 = document.getElementById('tag_flag');
									obj3.value = '1';
								}
							}
						</script>
						<div class="form-group">
							<label class="control-label col-md-4">Manager</label>
							<div class="col-md-7" style="display: none;" id="script1">
								<select id="r_atasan" name="r_atasan" required="required" onchange="javascript:getMgrid('r_atasan','r_mgrid')" class="form-control input-sm" /> 
									<option value="0">-- select manager --</option>
									<?php 
									foreach ($ShowMgr AS $ShowMgr)
									{
										echo '<option value= '.$ShowMgr['HR_ID'].'>'.$ShowMgr['NAME'].'</option>';
									};?>
								</select>
								<button type="button" class="btn btn-primary btn-sm" onclick="cek_other_mgr();">Back</button>
							</div>							
							<div class="col-md-7" style="display: block;" id="script2"> 
								<input type="text" value="" id="r_mgr" class="form-control input-sm" readonly="true"/>
								<button type="button" class="btn btn-primary btn-sm" onclick="cek_other_mgr();">Other</button>
							</div>
							<div class="col-md-4"></div>
							<div class="col-md-7">
								<input type="hidden" value="" name="r_mgrid" id="r_mgrid" class="form-control input-sm" size="10" readonly="true"/>
								<input type="hidden" value="" name="temp" id="temp" class="form-control input-sm" size="10" readonly="true"/>
								<input type="hidden" value="0" name="tag_flag" id="tag_flag" class="form-control input-sm" size="10" readonly="true"/>
								<? //nilai 0 artinya r_mgr yg ambil; nilai 1 artinya r_atasan yg diambil ?>
							</div>
						</div>
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7"><input type="text" value="" id="r_dept" class="form-control input-sm" readonly /></div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8"><input type="text" value="" id="r_job" class="form-control input-sm" readonly /></div>
						</div>
					</div>
				</div>
			</div>
			<div class="panel panel-default" style="padding-bottom: 30px;">
				<div class="panel-body">
					<div class="col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Vendor<span style="color:red;">*</span></label>							
							<div class="col-md-7">
								<select id="pVendorId" name="pVendorId" required="required" onchange="javascript:getVendorDetail()" class="form-control input-sm" /> 
								<option value="">-- select vendor --</option>
								<?php 
								foreach ($ShowVendor AS $ShowVendor)
								{
									echo '<option value= '.$ShowVendor['VENDOR_ID'].'>'.$ShowVendor['VENDOR_NAME'].'</option>';
								};?>
								</select>
							</div>
						</div>
						<div id="VendorDetail">
							<div class="form-group">
								<label class="control-label col-md-4">PIC</label>
								<div class="col-md-7"><input name="pPic" type="text" class="form-control input-sm" value="" size="30"></div>
							</div>
							<div class="form-group">
								<label class="control-label col-md-4">Job Desc.</label>
								<div class="col-md-7"><input name="pJabatan" type="text" class="form-control input-sm" value="" size="30"></div>
							</div>
						</div>
					</div>
									
					<div class="col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Date<span style="color:red;">*</span></label>
							<div class="col-md-6">
								<div class="input-group">
									<span class="input-group-addon"><small>From</small></span>
									<input type="text" class="form-control input-sm" required="required" name="G_Date2" id="G_Date2" value="<?php echo $dtNow?>">
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4"></label>
							<div class="col-md-6">
								<div class="input-group">
									<span class="input-group-addon"><small>To</small></span>
									<input type="text" class="form-control input-sm" required="required" name="G_Date3" id="G_Date3" value="<?php echo $dtNow?>">
								</div>
							</div>
						</div>						
						<div class="form-group">
							<label class="control-label col-md-4">Time<span style="color:red;">*</span></label>
							<div class="col-md-5">
								<div class="input-group">
									<span class="input-group-addon"><small>From</small></span>										
									<input type="text" class="form-control input-sm" required="required" id="G_Time4" name="G_Time4" value="07:00">
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4"></label>
							<div class="col-md-5">
								<div class="input-group">
									<span class="input-group-addon"><small>To</small></span>										
									<input type="text" class="form-control input-sm" required="required" id="G_Time5" name="G_Time5" value="07:00">
								</div>
							</div>
						</div>
					</div>
					
					<!--div class="col-md-12 well well-sm" style="margin-top:20px;">
						<div class="form-group">
							<div class="col-md-1"><input type="button" class="btn btn-sm btn-default" value="Add Form" onClick="addRow('dataTable')" /></div>
							<div class="col-md-1"><input type="button" class="btn btn-sm btn-default" value="Remove Form" onClick="deleteRow('dataTable')"/></div>
						</div>
						<div class="form-group">
							<div class="col-md-5"><label style="color:#003399">All actions apply only to entries with check marked checkboxes only.</label></div>
						</div>
						<div class="form-group">
							<div class="col-md-12">
								<table class="table table-bordered table-condensed table-striped" style="margin-bottom:0px">
									<tbody>
										<tr>
											<td class="tblhead" style="width:3%;text-align:center"></td>
											<th class="tblhead" style="width:3%;text-align:center">No.</th>
											<th class="tblhead" style="width:15%;text-align:center">Name</th>
											<th class="tblhead" style="width:20%;text-align:center">Job Description</th>
											<th class="tblhead" style="width:7%;text-align:center">Floor</th>										
											<th class="tblhead" style="width:20%;text-align:center">Location</th>
											<th class="tblhead" style="width:8%;text-align:center">Access</th>										
											<th class="tblhead" style="width:10%;text-align:center">Item Name</th>
											<th class="tblhead" style="width:15%;text-align:center">Serial#</th>										
										</tr>
									</tbody>
								</table>
								<!--table id="dataTable" class="table table-bordered table-condensed table-striped">
									<tbody>	
										<tr>
											<td style="width:3%;"><input type="checkbox" required="required" name="chk[]" /></td>
											<td style="width:3%;">1</td>
											<td style="width:15%;"><input type="text" id="W_Name" name="W_Name[]" class="form-control input-sm"/></td>
											<td style="width:20%;"><input type="text" id="W_Desc" name="W_Desc[]" class="form-control input-sm"/></td>
											<td style="width:7%;">
												<select id="W_Floor" name="W_Floor[]" class="form-control">
												< ?php 
												foreach ($ShowFloor AS $ShowFloor)
												{
													echo '<option value= '.$ShowFloor['MST_FLOOR_DESC'].'>'.$ShowFloor['MST_FLOOR_DESC'].'</option>';
												};?>
												</select>
											</td>
											<td style="width:20%;text-align:center"><input type="text" name="W_Location[]" class="form-control input-sm"/></td>
											<td style="width:8%;text-align:center">
												<select id="W_Access" name="W_Access[]" class="form-control">
												<option value="1">Yes</option>
												<option value="2">No</option>
												</select>
											</td>
											<td style="width:10%;text-align:center"><input type="text" name="W_Item[]" class="form-control input-sm"/></td>
											<td style="width:15%;text-align:center"><input type="text" name="W_Serial[]" class="form-control input-sm"/></td>																												
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div-->
					
					<div id="tablecontent" class="col-md-12" style="padding-top: 30px;">					
						<div class="form-group">
							<div class="table-responsive">
								<table class="table table-bordered table-condensed table-striped" style="background:#f9f9f9;">
									<thead>
										<tr>
											<th class="tblhead" style="width:3%;text-align:center">No.</th>
											<th class="tblhead" style="width:15%;text-align:center">Name</th>
											<th class="tblhead" style="width:20%;text-align:center">Job Description</th>
											<th class="tblhead" style="width:9%;text-align:center">Floor</th>										
											<th class="tblhead" style="width:15%;text-align:center">Location</th>
											<th class="tblhead" style="width:10%;text-align:center">Access</th>										
											<th class="tblhead" style="width:16%;text-align:center">Item Name</th>
											<th class="tblhead" style="width:18%;text-align:center">Serial#</th>																					
										</tr>
									</thead>
									<tbody>
										<tr>
											<td bgcolor="#FFFFFF" class="tbl-content-c" style="text-align:center;">1.</td>
											<td><input type="text" required="required" id="WP_Name1" class="form-control input-sm"/></td>											
											<td>
												<input type="text" required="required" id="WP_Job1" class="form-control input-sm"/>
											</td>						
											<td>
												<select id="WP_Floor1" class="form-control input-sm">
												<?php 
												foreach ($ShowFloor1 AS $ShowFloor)
												{
													echo '<option value= '.$ShowFloor['MST_FLOOR_DESC'].'>'.$ShowFloor['MST_FLOOR_DESC'].'</option>';
												};?>
												</select>
											</td>
											<td style="text-align:center"><input type="text" required="required" id="WP_Location1" class="form-control input-sm"/></td>
											<td style="text-align:center">
												<select id="WP_access1" name="WP_access1" class="form-control input-sm">
													<option value="1">Yes</option>
													<option value="2">No</option>
												</select>
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_item1" class="form-control input-sm"/>																						
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_serial1" class="form-control input-sm"/>																						
											</td>
										</tr>
										<tr>
											<td bgcolor="#FFFFFF" class="tbl-content-c" style="text-align:center;">2.</td>
											<td><input type="text" id="WP_Name2" class="form-control input-sm"/></td>											
											<td>
												<input type="text" id="WP_Job2" class="form-control input-sm"/>
											</td>						
											<td>
												<select id="WP_Floor2" class="form-control input-sm">
												<?php 
												foreach ($ShowFloor2 AS $ShowFloor)
												{
													echo '<option value= '.$ShowFloor['MST_FLOOR_DESC'].'>'.$ShowFloor['MST_FLOOR_DESC'].'</option>';
												};?>
												</select>
											</td>
											<td style="text-align:center"><input type="text" id="WP_Location2" class="form-control input-sm"/></td>
											<td style="text-align:center">
												<select id="WP_access2" name="WP_access2" class="form-control input-sm">
													<option value="1">Yes</option>
													<option value="2">No</option>
												</select>
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_item2" class="form-control input-sm"/>																						
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_serial2" class="form-control input-sm"/>																						
											</td>
										</tr>
										<tr>
											<td bgcolor="#FFFFFF" class="tbl-content-c" style="text-align:center;">3.</td>
											<td><input type="text" id="WP_Name3" class="form-control input-sm"/></td>											
											<td>
												<input type="text" id="WP_Job3" class="form-control input-sm"/>
											</td>						
											<td>
												<select id="WP_Floor3" class="form-control input-sm">
												<?php 
												foreach ($ShowFloor3 AS $ShowFloor)
												{
													echo '<option value= '.$ShowFloor['MST_FLOOR_DESC'].'>'.$ShowFloor['MST_FLOOR_DESC'].'</option>';
												};?>
												</select>
											</td>
											<td style="text-align:center"><input type="text" id="WP_Location3" class="form-control input-sm"/></td>
											<td style="text-align:center">
												<select id="WP_access3" name="WP_access3" class="form-control input-sm">
													<option value="1">Yes</option>
													<option value="2">No</option>
												</select>
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_item3" class="form-control input-sm"/>																						
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_serial3" class="form-control input-sm"/>																						
											</td>
										</tr>
										<tr>
											<td bgcolor="#FFFFFF" class="tbl-content-c" style="text-align:center;">4.</td>
											<td><input type="text" id="WP_Name4" class="form-control input-sm"/></td>											
											<td>
												<input type="text" id="WP_Job4" class="form-control input-sm"/>
											</td>						
											<td>
												<select id="WP_Floor4" class="form-control input-sm">
												<?php 
												foreach ($ShowFloor4 AS $ShowFloor)
												{
													echo '<option value= '.$ShowFloor['MST_FLOOR_DESC'].'>'.$ShowFloor['MST_FLOOR_DESC'].'</option>';
												};?>
												</select>
											</td>
											<td style="text-align:center"><input type="text" id="WP_Location4" class="form-control input-sm"/></td>
											<td style="text-align:center">
												<select id="WP_access4" name="WP_access4" class="form-control input-sm">
													<option value="1">Yes</option>
													<option value="2">No</option>
												</select>
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_item4" class="form-control input-sm"/>																						
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_serial4" class="form-control input-sm"/>																						
											</td>
										</tr>
										<tr>
											<td bgcolor="#FFFFFF" class="tbl-content-c" style="text-align:center;">5.</td>
											<td><input type="text" id="WP_Name5" class="form-control input-sm"/></td>											
											<td>
												<input type="text" id="WP_Job5" class="form-control input-sm"/>
											</td>						
											<td>
												<select id="WP_Floor5" class="form-control input-sm">
												<?php 
												foreach ($ShowFloor5 AS $ShowFloor)
												{
													echo '<option value= '.$ShowFloor['MST_FLOOR_DESC'].'>'.$ShowFloor['MST_FLOOR_DESC'].'</option>';
												};?>
												</select>
											</td>
											<td style="text-align:center"><input type="text" id="WP_Location5" class="form-control input-sm"/></td>
											<td style="text-align:center">
												<select id="WP_access5" name="WP_access5" class="form-control input-sm">
													<option value="1">Yes</option>
													<option value="2">No</option>
												</select>
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_item5" class="form-control input-sm"/>																						
											</td>
											<td style="text-align:center">
												<input type="text" id="WP_serial5" class="form-control input-sm"/>																						
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
					
					<div class="col-sm-8" style="margin-top:10px;">				
						<div class="col-sm-7"><label for="button" class="control-label">&nbsp;</label></div>
						<div class="col-sm-4">
							<!--input type="submit" name="submit" class="btn btn-md btn-success" value="Submit This Form"  onclick="return cekDulu(this);"-->
							<button type="button" class="btn btn-success btn-md" onclick="Insert_wp()">
							<!--span class="glyphicon glyphicon-saved"></span--> Save This Form</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	</form>
</div>

<script type="text/javascript">
	/*
	$('#date1').datetimepicker({
		scrollInput:false,
		closeOnDateSelect:true,
		datepicker:true,
		timepicker:false,
		format:'d/m/Y',
		minDate:'-1970/01/01',
		onGenerate:function( ct ){$(this).find('.xdsoft_date.xdsoft_weekend').addClass('xdsoft_disabled');}
	});
	
	$('#date2').datetimepicker({
		scrollInput:false,
		closeOnDateSelect:true,
		datepicker:true,
		timepicker:false,
		format:'d/m/Y',
		minDate:'-1970/01/01',
		onGenerate:function( ct ){$(this).find('.xdsoft_date.xdsoft_weekend').addClass('xdsoft_disabled');}
	});
	*/
	
	function getVendorDetail()
	{
		var pVendorId = {pVendorId:$("#pVendorId").val()};
		$.ajax({
				type: "POST",
				url : "<?php echo site_url('work_facility/ShowVendorDetail');?>",
				data: pVendorId,
				success: function(msg){$('#VendorDetail').html(msg);}
			});
	};
	
	function Insert_wp()
	{
		var eRRor='0';
		
		$r_name = $('#r_name').val();
		if ($r_name==""){alert('Requestor tidak boleh kosong!'); document.getElementById('r_name').focus(); eRRor='1'; return false;}
		
		$pVendorId = $('#pVendorId').val();
		if ($pVendorId==""){alert('Vendor tidak boleh kosong!'); document.getElementById('pVendorId').focus(); eRRor='1'; return false;}
		
		$temp = 
	}
	
</script>